import { observable, action } from 'mobx'
import * as api from 'lib/constants/api'
import { post } from 'lib/net'
import Toast from 'components/toast'
import Load from 'components/load'

// class AddressModel {
//   constructor (data) {
//     if (data) {
//     }
//   }
// }

export default class ComplaintRecordVM {
  constructor (props) {
    this.props = props
    this.PageInitialization()
  }

 // 记录
 @observable record = false

 // 客户投诉已扣除记录
 @observable complaintRecordDetail = []

 @action PageInitialization = async () => {
   Load.loading(1, '加载中')
   const UserId = window.localStorage.getItem('UserId')
   let response = await post(api.GETCOMPLATIONBYWZ, { WZId: UserId, RecordType: 0 })
   if (response.Success) {
     Load.loading(2, '加载完成')
     this.complaintRecordDetail = response.Value
     setTimeout(() => {
       this.record = true
     })
   } else {
     Toast.fail(response.Message)
   }
 }
}
